/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('resourcecenter', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AssociateDefaultFilterRequest {
  filterName?: string(name='FilterName', description='The name of the filter.

This parameter is required.', example='My Filters'),
}

model AssociateDefaultFilterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='54673B22-2001-556A-B394-B8697AA9670B'),
}

model AssociateDefaultFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AssociateDefaultFilterResponseBody(name='body'),
}

/**
 * @summary Sets a default filter.
 *
 * @param request AssociateDefaultFilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AssociateDefaultFilterResponse
 */
async function associateDefaultFilterWithOptions(request: AssociateDefaultFilterRequest, runtime: Util.RuntimeOptions): AssociateDefaultFilterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filterName)) {
    query['FilterName'] = request.filterName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AssociateDefaultFilter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Sets a default filter.
 *
 * @param request AssociateDefaultFilterRequest
 * @return AssociateDefaultFilterResponse
 */
async function associateDefaultFilter(request: AssociateDefaultFilterRequest): AssociateDefaultFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateDefaultFilterWithOptions(request, runtime);
}

model CreateFilterRequest {
  filterConfiguration?: string(name='FilterConfiguration', description='The configurations of the filter.

This parameter is required.', example='{
  "regions": [],
  "tagFilters": [
    [{ "type": "notContainTagKey", "tagKey": "xxx", "tagValue": "" }],
    [{ "tagKey": "xxx", "tagValue": "xxx" }]
  ],
  "resourceTypes": [
    "ACS::ECS::AutoSnapshotPolicy"
  ]
}'),
  filterName?: string(name='FilterName', description='The name of the filter.

This parameter is required.', example='ECS'),
}

model CreateFilterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='EEF1EE1F-50F6-5494-B3DA-8F597DEB31BF'),
}

model CreateFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFilterResponseBody(name='body'),
}

/**
 * @summary Creates a filter.
 *
 * @param request CreateFilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFilterResponse
 */
async function createFilterWithOptions(request: CreateFilterRequest, runtime: Util.RuntimeOptions): CreateFilterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filterConfiguration)) {
    query['FilterConfiguration'] = request.filterConfiguration;
  }
  if (!Util.isUnset(request.filterName)) {
    query['FilterName'] = request.filterName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFilter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a filter.
 *
 * @param request CreateFilterRequest
 * @return CreateFilterResponse
 */
async function createFilter(request: CreateFilterRequest): CreateFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFilterWithOptions(request, runtime);
}

model CreateSavedQueryRequest {
  description?: string(name='Description', description='The description of the template.

The description must be 1 to 256 characters in length.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
  expression?: string(name='Expression', description='The query statement in the template.

This parameter is required.', example='SELECT * FROM resources;'),
  name?: string(name='Name', description='The name of the template.

*   The name must be 1 to 64 characters in length.
*   The name can contain letters, digits, underscores (_), and hyphens (-).
*   The name must be unique.

This parameter is required.', example='Query of All Alibaba Cloud Resources'),
}

model CreateSavedQueryResponseBody = {
  queryId?: string(name='QueryId', description='The template ID.', example='sq-GeAck****'),
  requestId?: string(name='RequestId', description='The request ID.', example='EFA806B9-7F36-55AB-8B7A-D680C2C5EE57'),
}

model CreateSavedQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSavedQueryResponseBody(name='body'),
}

/**
 * @summary Creates a custom query template.
 *
 * @param request CreateSavedQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSavedQueryResponse
 */
async function createSavedQueryWithOptions(request: CreateSavedQueryRequest, runtime: Util.RuntimeOptions): CreateSavedQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSavedQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a custom query template.
 *
 * @param request CreateSavedQueryRequest
 * @return CreateSavedQueryResponse
 */
async function createSavedQuery(request: CreateSavedQueryRequest): CreateSavedQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSavedQueryWithOptions(request, runtime);
}

model DeleteFilterRequest {
  filterName?: string(name='FilterName', description='The name of the filter.

This parameter is required.', example='ECS'),
}

model DeleteFilterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='A4A63E3C-89EC-51F9-9934-C9AF1BCBAAA5'),
}

model DeleteFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFilterResponseBody(name='body'),
}

/**
 * @summary Deletes a filter.
 *
 * @param request DeleteFilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFilterResponse
 */
async function deleteFilterWithOptions(request: DeleteFilterRequest, runtime: Util.RuntimeOptions): DeleteFilterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filterName)) {
    query['FilterName'] = request.filterName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFilter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a filter.
 *
 * @param request DeleteFilterRequest
 * @return DeleteFilterResponse
 */
async function deleteFilter(request: DeleteFilterRequest): DeleteFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFilterWithOptions(request, runtime);
}

model DeleteSavedQueryRequest {
  queryId?: string(name='QueryId', description='The ID of the template.

You can call the [ListSavedQueries](~~ListSavedQueries~~) operation to obtain the template ID.

This parameter is required.', example='sq-GeAck****'),
}

model DeleteSavedQueryResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D170D58E-6256-5344-8F5E-922EC9ECB7EA'),
}

model DeleteSavedQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSavedQueryResponseBody(name='body'),
}

/**
 * @summary Deletes a custom query template.
 *
 * @param request DeleteSavedQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSavedQueryResponse
 */
async function deleteSavedQueryWithOptions(request: DeleteSavedQueryRequest, runtime: Util.RuntimeOptions): DeleteSavedQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.queryId)) {
    query['QueryId'] = request.queryId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSavedQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a custom query template.
 *
 * @param request DeleteSavedQueryRequest
 * @return DeleteSavedQueryResponse
 */
async function deleteSavedQuery(request: DeleteSavedQueryRequest): DeleteSavedQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSavedQueryWithOptions(request, runtime);
}

model DisableMultiAccountResourceCenterResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='4951F920-48DB-5731-96AA-3A7C8AE617D9'),
}

model DisableMultiAccountResourceCenterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableMultiAccountResourceCenterResponseBody(name='body'),
}

/**
 * @summary Disables the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @param request DisableMultiAccountResourceCenterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableMultiAccountResourceCenterResponse
 */
async function disableMultiAccountResourceCenterWithOptions(runtime: Util.RuntimeOptions): DisableMultiAccountResourceCenterResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DisableMultiAccountResourceCenter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disables the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @return DisableMultiAccountResourceCenterResponse
 */
async function disableMultiAccountResourceCenter(): DisableMultiAccountResourceCenterResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableMultiAccountResourceCenterWithOptions(runtime);
}

model DisableResourceCenterResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D170D58E-6256-5344-8F5E-922EC9ECB7EA'),
}

model DisableResourceCenterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableResourceCenterResponseBody(name='body'),
}

/**
 * @summary Deactivates the Resource Center service.
 *
 * @param request DisableResourceCenterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableResourceCenterResponse
 */
async function disableResourceCenterWithOptions(runtime: Util.RuntimeOptions): DisableResourceCenterResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DisableResourceCenter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deactivates the Resource Center service.
 *
 * @return DisableResourceCenterResponse
 */
async function disableResourceCenter(): DisableResourceCenterResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableResourceCenterWithOptions(runtime);
}

model DisassociateDefaultFilterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='BCAB07BA-82FA-5DC0-9322-FB7ED726481D'),
}

model DisassociateDefaultFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisassociateDefaultFilterResponseBody(name='body'),
}

/**
 * @summary Cancels the default filter.
 *
 * @param request DisassociateDefaultFilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisassociateDefaultFilterResponse
 */
async function disassociateDefaultFilterWithOptions(runtime: Util.RuntimeOptions): DisassociateDefaultFilterResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DisassociateDefaultFilter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Cancels the default filter.
 *
 * @return DisassociateDefaultFilterResponse
 */
async function disassociateDefaultFilter(): DisassociateDefaultFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return disassociateDefaultFilterWithOptions(runtime);
}

model EnableMultiAccountResourceCenterResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='767038B7-2027-5508-858B-E213232D57D5'),
  status?: string(name='Status', description='The status of the feature. Valid values:

*   Pending: The feature is being enabled.
*   Enabled: The feature is enabled.', example='Pending'),
}

model EnableMultiAccountResourceCenterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableMultiAccountResourceCenterResponseBody(name='body'),
}

/**
 * @summary Enables the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @description If you have created a resource directory for your enterprise, you can enable the cross-account resource search feature by using the management account of the resource directory or a delegated administrator account of Resource Center to view the resources of members in the resource directory. For more information about a resource directory, see [Resource Directory overview](https://help.aliyun.com/document_detail/200506.html).
 *
 * @param request EnableMultiAccountResourceCenterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableMultiAccountResourceCenterResponse
 */
async function enableMultiAccountResourceCenterWithOptions(runtime: Util.RuntimeOptions): EnableMultiAccountResourceCenterResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'EnableMultiAccountResourceCenter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @description If you have created a resource directory for your enterprise, you can enable the cross-account resource search feature by using the management account of the resource directory or a delegated administrator account of Resource Center to view the resources of members in the resource directory. For more information about a resource directory, see [Resource Directory overview](https://help.aliyun.com/document_detail/200506.html).
 *
 * @return EnableMultiAccountResourceCenterResponse
 */
async function enableMultiAccountResourceCenter(): EnableMultiAccountResourceCenterResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableMultiAccountResourceCenterWithOptions(runtime);
}

model EnableResourceCenterResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='45357BEF-AB50-5E4D-B05D-5A882A4BE924'),
  status?: string(name='Status', description='The activation status of the service. Valid values:

*   Pending: The service is being activated.
*   Enabled: The service is activated.', example='Pending'),
}

model EnableResourceCenterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableResourceCenterResponseBody(name='body'),
}

/**
 * @summary Activates the Resource Center service.
 *
 * @param request EnableResourceCenterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableResourceCenterResponse
 */
async function enableResourceCenterWithOptions(runtime: Util.RuntimeOptions): EnableResourceCenterResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'EnableResourceCenter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Activates the Resource Center service.
 *
 * @return EnableResourceCenterResponse
 */
async function enableResourceCenter(): EnableResourceCenterResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableResourceCenterWithOptions(runtime);
}

model ExecuteMultiAccountSQLQueryRequest {
  expression?: string(name='Expression', description='The SQL statement to be executed.

The number of characters in the SQL statement must be less than 2,000.

For more information about the SQL syntax, see [Basic SQL syntax](https://help.aliyun.com/document_detail/2539395.html).

This parameter is required.', example='SELECT * FROM resources LIMIT 100;'),
  maxResults?: int32(name='MaxResults', example='1000'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  scope?: string(name='Scope', description='The search scope. The value of this parameter can be one of the following items:

*   ID of a resource directory: Resources within the management account and all members of the resource directory are searched.
*   ID of the Root folder: Resources within all members in the Root folder and the subfolders of the Root folder are searched.
*   ID of a folder: Resources within all members in the folder are searched.
*   ID of a member: Resources within the member are searched.
*   ID of a member/ID of a Resource group: Resources within the member in the resource group are searched.

For more information about how to obtain the ID of a resource directory, the Root folder, a folder, a member, or a resource group, see [GetResourceDirectory](https://help.aliyun.com/document_detail/159995.html), [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html), [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html), [ListAccounts](https://help.aliyun.com/document_detail/160016.html), or [ListResourceGroups](https://help.aliyun.com/document_detail/158855.html).

This parameter is required.', example='rd-r4****'),
}

model ExecuteMultiAccountSQLQueryResponseBody = {
  columns?: [ 
    {
      name?: string(name='Name', description='The name of the column.', example='resource_id'),
      type?: string(name='Type', description='The type of the column.', example='varchar'),
    }
  ](name='Columns', description='The columns.'),
  maxResults?: int32(name='MaxResults', description='The number of entries per page.', example='1000'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The request ID.', example='44C8A952-D6B0-5BC8-82D5-93BA02E26F2E'),
  rows?: [ any ](name='Rows', description='An array of search results.'),
}

model ExecuteMultiAccountSQLQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExecuteMultiAccountSQLQueryResponseBody(name='body'),
}

/**
 * @summary Executes an SQL statement to query resources across accounts.
 *
 * @param request ExecuteMultiAccountSQLQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExecuteMultiAccountSQLQueryResponse
 */
async function executeMultiAccountSQLQueryWithOptions(request: ExecuteMultiAccountSQLQueryRequest, runtime: Util.RuntimeOptions): ExecuteMultiAccountSQLQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteMultiAccountSQLQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Executes an SQL statement to query resources across accounts.
 *
 * @param request ExecuteMultiAccountSQLQueryRequest
 * @return ExecuteMultiAccountSQLQueryResponse
 */
async function executeMultiAccountSQLQuery(request: ExecuteMultiAccountSQLQueryRequest): ExecuteMultiAccountSQLQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeMultiAccountSQLQueryWithOptions(request, runtime);
}

model ExecuteSQLQueryRequest {
  expression?: string(name='Expression', description='The SQL statement to be executed.

The number of characters in the SQL statement must be less than 2,000.

For more information about the SQL syntax, see [Basic SQL syntax](https://help.aliyun.com/document_detail/2539395.html).

This parameter is required.', example='SELECT * FROM resources LIMIT 100;'),
  maxResults?: int32(name='MaxResults', example='1000'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  scope?: string(name='Scope', description='The search scope.

Set this parameter to the ID of a resource group.

For information about how to obtain the ID of a resource group, see [ListResourceGroups](https://help.aliyun.com/document_detail/158855.html).', example='rg-acfmzawhxxc****'),
}

model ExecuteSQLQueryResponseBody = {
  columns?: [ 
    {
      name?: string(name='Name', description='The name of the column.', example='resource_id'),
      type?: string(name='Type', description='The type of the column.', example='varchar'),
    }
  ](name='Columns', description='The columns.'),
  maxResults?: int32(name='MaxResults', description='The number of entries per page.', example='1000'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The request ID.', example='D696E6EF-3A6D-5770-801E-4982081FE4D0'),
  rows?: [ any ](name='Rows', description='An array of search results.'),
}

model ExecuteSQLQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExecuteSQLQueryResponseBody(name='body'),
}

/**
 * @summary Executes an SQL statement to query the resources that can be accessed within the current account.
 *
 * @param request ExecuteSQLQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExecuteSQLQueryResponse
 */
async function executeSQLQueryWithOptions(request: ExecuteSQLQueryRequest, runtime: Util.RuntimeOptions): ExecuteSQLQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteSQLQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Executes an SQL statement to query the resources that can be accessed within the current account.
 *
 * @param request ExecuteSQLQueryRequest
 * @return ExecuteSQLQueryResponse
 */
async function executeSQLQuery(request: ExecuteSQLQueryRequest): ExecuteSQLQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeSQLQueryWithOptions(request, runtime);
}

model GetExampleQueryRequest {
  queryId?: string(name='QueryId', description='The ID of the template.

>  You can call the [ListExampleQueries](~~ListExampleQueries~~) operation to obtain the template ID.

This parameter is required.', example='sq-0PfKy****'),
}

model GetExampleQueryResponseBody = {
  exampleQuery?: {
    description?: string(name='Description', description='The description of the template.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
    expression?: string(name='Expression', description='The query statement in the template.', example='SELECT
  resource_id,
  resource_name,
  region_id,
  zone_id,
  resource_type,
  account_id,
  create_time,
  resource_group_id,
  tags,
  ip_addresses,
  vpc_id,
  v_switch_id
FROM
  resources
ORDER BY
  resource_type,
  resource_id
LIMIT
  1000 OFFSET 0;'),
    name?: string(name='Name', description='The name of the template.', example='Query of All Alibaba Cloud Resources'),
    queryId?: string(name='QueryId', description='The ID of the template.', example='sq-0PfKy****'),
  }(name='ExampleQuery', description='The information about the sample query template.'),
  requestId?: string(name='RequestId', description='The request ID.', example='36A3D9BE-B607-5993-B546-7E19EF65DC00'),
}

model GetExampleQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetExampleQueryResponseBody(name='body'),
}

/**
 * @summary Queries the information about a sample query template.
 *
 * @param request GetExampleQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetExampleQueryResponse
 */
async function getExampleQueryWithOptions(request: GetExampleQueryRequest, runtime: Util.RuntimeOptions): GetExampleQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.queryId)) {
    query['QueryId'] = request.queryId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetExampleQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about a sample query template.
 *
 * @param request GetExampleQueryRequest
 * @return GetExampleQueryResponse
 */
async function getExampleQuery(request: GetExampleQueryRequest): GetExampleQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return getExampleQueryWithOptions(request, runtime);
}

model GetMultiAccountResourceCenterServiceStatusResponseBody = {
  initialStatus?: string(name='InitialStatus', description='The initialization status of the feature. Valid values:

*   Pending: The feature is being initialized.
*   Finished: The feature is initialized.', example='Pending'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='81671397-1425-51F1-A144-4799E01BEBFF'),
  serviceStatus?: string(name='ServiceStatus', description='The status of the feature. Valid values:

*   Enabled: The feature is enabled.
*   Disabled: The feature is disabled.', example='Enabled'),
}

model GetMultiAccountResourceCenterServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMultiAccountResourceCenterServiceStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @param request GetMultiAccountResourceCenterServiceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMultiAccountResourceCenterServiceStatusResponse
 */
async function getMultiAccountResourceCenterServiceStatusWithOptions(runtime: Util.RuntimeOptions): GetMultiAccountResourceCenterServiceStatusResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetMultiAccountResourceCenterServiceStatus',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of the cross-account resource search feature by using the management account of a resource directory or a delegated administrator account of Resource Center.
 *
 * @return GetMultiAccountResourceCenterServiceStatusResponse
 */
async function getMultiAccountResourceCenterServiceStatus(): GetMultiAccountResourceCenterServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMultiAccountResourceCenterServiceStatusWithOptions(runtime);
}

model GetMultiAccountResourceConfigurationRequest {
  accountId?: string(name='AccountId', description='The ID of the management account or member of the resource directory.

This parameter is required.', example='1619302****'),
  resourceId?: string(name='ResourceId', description='The ID of the resource.

This parameter is required.', example='m-eb3hji****'),
  resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the resource.

This parameter is required.', example='cn-shanghai'),
  resourceType?: string(name='ResourceType', description='The type of the resource.

This parameter is required.', example='ACS::VPC::RouteTable'),
}

model GetMultiAccountResourceConfigurationResponseBody = {
  accountId?: string(name='AccountId', description='The ID of the management account or member of the resource directory.', example='1619302****'),
  configuration?: map[string]any(name='Configuration', description='The configurations of the resource.'),
  createTime?: string(name='CreateTime', description='The time when the resource was created.', example='2023-02-14T03:12:11Z'),
  expireTime?: string(name='ExpireTime', description='The time when the resource expires.', example='2023-09-18T07:04:21Z'),
  ipAddressAttributes?: [ 
    {
      ipAddress?: string(name='IpAddress', description='The IP address.', example='172.27.199.42'),
      networkType?: string(name='NetworkType', description='The network type. Valid values:

*   **Public**: the Internet
*   **Private**: internal network', example='Public'),
      version?: string(name='Version', description='The version.', example='Ipv4'),
    }
  ](name='IpAddressAttributes', description='The attributes of the IP address.'),
  ipAddresses?: [ string ](name='IpAddresses', description='The IP addresses.

> Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.'),
  regionId?: string(name='RegionId', description='The region ID of the resource.', example='cn-shanghai'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B2DCC08B-C12A-5705-879C-5A1450016156'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the resource belongs.', example='rg-acfmzy6d****'),
  resourceId?: string(name='ResourceId', description='The ID of the resource.', example='m-eb3hji****'),
  resourceName?: string(name='ResourceName', description='The name of the resource.', example='test_resource'),
  resourceType?: string(name='ResourceType', description='The type of the resource.', example='ACS::VPC::RouteTable'),
  tags?: [ 
    {
      key?: string(name='Key', description='The key of tag N.', example='tag-key'),
      value?: string(name='Value', description='The value of tag N.', example='tag-value'),
    }
  ](name='Tags', description='The tags of the resource.'),
  zoneId?: string(name='ZoneId', description='The zone ID of the resource.', example='cn-shanghai-a'),
}

model GetMultiAccountResourceConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMultiAccountResourceConfigurationResponseBody(name='body'),
}

/**
 * @summary Queries the configurations of a resource within the management account or a member of a resource directory.
 *
 * @param request GetMultiAccountResourceConfigurationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMultiAccountResourceConfigurationResponse
 */
async function getMultiAccountResourceConfigurationWithOptions(request: GetMultiAccountResourceConfigurationRequest, runtime: Util.RuntimeOptions): GetMultiAccountResourceConfigurationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceRegionId)) {
    query['ResourceRegionId'] = request.resourceRegionId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetMultiAccountResourceConfiguration',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the configurations of a resource within the management account or a member of a resource directory.
 *
 * @param request GetMultiAccountResourceConfigurationRequest
 * @return GetMultiAccountResourceConfigurationResponse
 */
async function getMultiAccountResourceConfiguration(request: GetMultiAccountResourceConfigurationRequest): GetMultiAccountResourceConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMultiAccountResourceConfigurationWithOptions(request, runtime);
}

model GetResourceCenterServiceStatusResponseBody = {
  initialStatus?: string(name='InitialStatus', description='The initialization status of the service. Valid values:

*   Pending: The service is being initialized.
*   Finished: The service is initialized.', example='Pending'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='AD5F848D-CCDC-5464-93E1-4BA50A4826DD'),
  serviceStatus?: string(name='ServiceStatus', description='The status of the service. Valid values:

*   Enabled: The service is activated.
*   Disabled: The service is deactivated.', example='Enabled'),
}

model GetResourceCenterServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceCenterServiceStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of the Resource Center service.
 *
 * @param request GetResourceCenterServiceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceCenterServiceStatusResponse
 */
async function getResourceCenterServiceStatusWithOptions(runtime: Util.RuntimeOptions): GetResourceCenterServiceStatusResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetResourceCenterServiceStatus',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of the Resource Center service.
 *
 * @return GetResourceCenterServiceStatusResponse
 */
async function getResourceCenterServiceStatus(): GetResourceCenterServiceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceCenterServiceStatusWithOptions(runtime);
}

model GetResourceConfigurationRequest {
  resourceId?: string(name='ResourceId', description='The ID of the resource.

This parameter is required.', example='eip-bp1kyg72m****'),
  resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the resource.

This parameter is required.', example='cn-shanghai'),
  resourceType?: string(name='ResourceType', description='The type of the resource.

For more information about the resource types supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).

This parameter is required.', example='ACS::VPC::RouteTable'),
}

model GetResourceConfigurationResponseBody = {
  accountId?: string(name='AccountId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='151266687691****'),
  configuration?: map[string]any(name='Configuration', description='The configurations of the resource.'),
  createTime?: string(name='CreateTime', description='The time when the resource was created.', example='2021-06-30T09:20:08Z'),
  expireTime?: string(name='ExpireTime', description='The time when the resource expires.', example='2021-07-30T09:20:08Z'),
  ipAddressAttributes?: [ 
    {
      ipAddress?: string(name='IpAddress', description='The IP address.', example='192.168.1.2'),
      networkType?: string(name='NetworkType', description='The network type. Valid values:

*   **Public**: the Internet
*   **Private**: internal network', example='Public'),
      version?: string(name='Version', description='The version.', example='Ipv4'),
    }
  ](name='IpAddressAttributes', description='The attributes of the IP address.'),
  ipAddresses?: [ string ](name='IpAddresses', description='The IP addresses.

> Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.'),
  regionId?: string(name='RegionId', description='The region ID of the resource.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='F1CE0D52-32DA-531A-87A4-B9A5B68D5D8E'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the resource belongs.', example='rg-acfmv4k****'),
  resourceId?: string(name='ResourceId', description='The ID of the resource.', example='vtb-uf6978gdqbi****'),
  resourceName?: string(name='ResourceName', description='The name of the resource.', example='group1'),
  resourceType?: string(name='ResourceType', description='The type of the resource.', example='ACS::VPC::VSwitch'),
  tags?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='test-key'),
      value?: string(name='Value', description='The tag value.', example='test-value'),
    }
  ](name='Tags', description='The tags of the resource.'),
  zoneId?: string(name='ZoneId', description='The zone ID of the resource.', example='cn-hangzhou-k'),
}

model GetResourceConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceConfigurationResponseBody(name='body'),
}

/**
 * @summary Queries the configurations of a resource within the current account.
 *
 * @param request GetResourceConfigurationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceConfigurationResponse
 */
async function getResourceConfigurationWithOptions(request: GetResourceConfigurationRequest, runtime: Util.RuntimeOptions): GetResourceConfigurationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceRegionId)) {
    query['ResourceRegionId'] = request.resourceRegionId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceConfiguration',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the configurations of a resource within the current account.
 *
 * @param request GetResourceConfigurationRequest
 * @return GetResourceConfigurationResponse
 */
async function getResourceConfiguration(request: GetResourceConfigurationRequest): GetResourceConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceConfigurationWithOptions(request, runtime);
}

model GetResourceCountsRequest {
  filter?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition. For more information, see `Supported filter parameters`.', example='RegionId'),
      matchType?: string(name='MatchType', description='The matching mode.

The value Equals indicates an equal match.', example='Equals'),
      value?: [ string ](name='Value', description='The values of the filter condition.'),
    }
  ](name='Filter', description='The filter conditions.'),
  groupByKey?: string(name='GroupByKey', description='The dimension by which resources are queried. Valid values:

*   ResourceType
*   Region
*   ResourceGroupId
*   TagKey
*   TagValue', example='ResourceType'),
}

model GetResourceCountsResponseBody = {
  filters?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition.', example='RegionId'),
      values?: [ string ](name='Values', description='The values of the filter condition.'),
    }
  ](name='Filters', description='The filter conditions.'),
  groupByKey?: string(name='GroupByKey', description='The dimension by which resources are queried.', example='ResourceType'),
  requestId?: string(name='RequestId', description='The request ID.', example='6D98D9B0-318D-56A4-910C-93B5F945AF2B'),
  resourceCounts?: [ 
    {
      count?: long(name='Count', description='The number of resources.', example='2'),
      groupName?: string(name='GroupName', description='The group name.', example='ACS::ECS::NetworkInterface'),
    }
  ](name='ResourceCounts', description='The numbers of resources.'),
}

model GetResourceCountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceCountsResponseBody(name='body'),
}

/**
 * @summary Queries the numbers of resources on which the current account has access permissions.
 *
 * @param request GetResourceCountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceCountsResponse
 */
async function getResourceCountsWithOptions(request: GetResourceCountsRequest, runtime: Util.RuntimeOptions): GetResourceCountsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.groupByKey)) {
    query['GroupByKey'] = request.groupByKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceCounts',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the numbers of resources on which the current account has access permissions.
 *
 * @param request GetResourceCountsRequest
 * @return GetResourceCountsResponse
 */
async function getResourceCounts(request: GetResourceCountsRequest): GetResourceCountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourceCountsWithOptions(request, runtime);
}

model GetSavedQueryRequest {
  queryId?: string(name='QueryId', description='The template ID.

>  You can call the [ListSavedQueries](~~ListSavedQueries~~) operation to query the ID.

This parameter is required.', example='sq-GeAck****'),
}

model GetSavedQueryResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='6D98D9B0-318D-56A4-910C-93B5F945AF2B'),
  savedQuery?: {
    createTime?: string(name='CreateTime', description='The time when the template was created. The time is displayed in UTC.', example='2023-10-30T01:43:16Z'),
    description?: string(name='Description', description='The description of the template.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
    expression?: string(name='Expression', description='The query statement in the template.', example='SELECT * FROM resources;'),
    name?: string(name='Name', description='The name of the template.', example='Query of All Alibaba Cloud Resources'),
    queryId?: string(name='QueryId', description='The template ID.', example='sq-GeAck****'),
    updateTime?: string(name='UpdateTime', description='The time when the template was updated. The time is displayed in UTC.', example='2023-10-30T01:43:16Z'),
  }(name='SavedQuery', description='The information about the template.'),
}

model GetSavedQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSavedQueryResponseBody(name='body'),
}

/**
 * @summary Queries the information about a custom query template.
 *
 * @param request GetSavedQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSavedQueryResponse
 */
async function getSavedQueryWithOptions(request: GetSavedQueryRequest, runtime: Util.RuntimeOptions): GetSavedQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.queryId)) {
    query['QueryId'] = request.queryId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSavedQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about a custom query template.
 *
 * @param request GetSavedQueryRequest
 * @return GetSavedQueryResponse
 */
async function getSavedQuery(request: GetSavedQueryRequest): GetSavedQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSavedQueryWithOptions(request, runtime);
}

model ListExampleQueriesRequest {
  maxResults?: string(name='MaxResults', description='The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 50.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
}

model ListExampleQueriesResponseBody = {
  exampleQueries?: [ 
    {
      description?: string(name='Description', description='The description of the template.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
      name?: string(name='Name', description='The name of the template.', example='Query of All Alibaba Cloud Resources'),
      queryId?: string(name='QueryId', description='The ID of the template.', example='sq-0PfKy****'),
    }
  ](name='ExampleQueries', description='The information about the sample query templates.'),
  maxResults?: string(name='MaxResults', description='The maximum number of entries per page.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The request ID.', example='D696E6EF-3A6D-5770-801E-4982081FE4D0'),
}

model ListExampleQueriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExampleQueriesResponseBody(name='body'),
}

/**
 * @summary Queries all sample query templates.
 *
 * @param request ListExampleQueriesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExampleQueriesResponse
 */
async function listExampleQueriesWithOptions(request: ListExampleQueriesRequest, runtime: Util.RuntimeOptions): ListExampleQueriesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExampleQueries',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all sample query templates.
 *
 * @param request ListExampleQueriesRequest
 * @return ListExampleQueriesResponse
 */
async function listExampleQueries(request: ListExampleQueriesRequest): ListExampleQueriesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listExampleQueriesWithOptions(request, runtime);
}

model ListFiltersResponseBody = {
  defaultFilterName?: string(name='DefaultFilterName', description='The name of the default filter.', example='My Filters'),
  filters?: [ 
    {
      filterConfiguration?: string(name='FilterConfiguration', description='The configurations of the filter.

This parameter is required.', example='{
  "regions": [],
  "tagFilters": [
    [{ "type": "notContainTagKey", "tagKey": "xxx", "tagValue": "" }],
    [{ "tagKey": "xxx", "tagValue": "xxx" }]
  ],
  "resourceTypes": [
    "ACS::ECS::AutoSnapshotPolicy"
  ]
}'),
      filterName?: string(name='FilterName', description='The name of the filter.', example='My devices'),
    }
  ](name='Filters', description='The configurations of the filter.'),
  requestId?: string(name='RequestId', description='The request ID.', example='AA39FB9C-CB74-5E73-8DFE-3A2B096F0759'),
}

model ListFiltersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFiltersResponseBody(name='body'),
}

/**
 * @summary Queries a list of filters.
 *
 * @param request ListFiltersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFiltersResponse
 */
async function listFiltersWithOptions(runtime: Util.RuntimeOptions): ListFiltersResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListFilters',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of filters.
 *
 * @return ListFiltersResponse
 */
async function listFilters(): ListFiltersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFiltersWithOptions(runtime);
}

model ListMultiAccountResourceGroupsRequest {
  accountId?: string(name='AccountId', description='The ID of the management account or member of the resource directory.

This parameter is required.', example='1394339739****'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Maximum value: 100. Default value: 10.', example='20'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAAS2Nboi3t4xGrdlG5/Ks/Q1xPG9jzviYEuZydevXIkgF'),
  resourceGroupIds?: [ string ](name='ResourceGroupIds', description='The IDs of resource groups.'),
}

model ListMultiAccountResourceGroupsResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAAU5VsT9R1adMTuz9GzginZ3Y+7Y/5JATS+6q5GK9kT75'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FF0A66E-781F-51EE-9531-928F197558F2'),
  resourceGroups?: [ 
    {
      accountId?: string(name='AccountId', description='The ID of the management account or member of the resource directory.', example='1394339739****'),
      createDate?: string(name='CreateDate', description='The time when the resource group was created.', example='2021-06-30T09:20:08Z'),
      displayName?: string(name='DisplayName', description='The display name of the resource group.', example='group1'),
      id?: string(name='Id', description='The ID of the resource group.', example='rg-acfmzawhxxc****'),
      name?: string(name='Name', description='The unique identifier of the resource group.', example='my-project'),
      status?: string(name='Status', description='The status of the resource group. Valid values:

*   Creating: The resource group is being created.
*   OK: The resource group is created.
*   PendingDelete: The resource group is waiting to be deleted.', example='OK'),
    }
  ](name='ResourceGroups', description='The information about the resource groups.'),
}

model ListMultiAccountResourceGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMultiAccountResourceGroupsResponseBody(name='body'),
}

/**
 * @summary Queries the resource groups within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountResourceGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMultiAccountResourceGroupsResponse
 */
async function listMultiAccountResourceGroupsWithOptions(request: ListMultiAccountResourceGroupsRequest, runtime: Util.RuntimeOptions): ListMultiAccountResourceGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.resourceGroupIds)) {
    query['ResourceGroupIds'] = request.resourceGroupIds;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMultiAccountResourceGroups',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the resource groups within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountResourceGroupsRequest
 * @return ListMultiAccountResourceGroupsResponse
 */
async function listMultiAccountResourceGroups(request: ListMultiAccountResourceGroupsRequest): ListMultiAccountResourceGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMultiAccountResourceGroupsWithOptions(request, runtime);
}

model ListMultiAccountResourceRelationshipsRequest {
  maxResults?: int32(name='MaxResults', example='10'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  relatedResourceFilter?: [ 
    {
      key?: string(name='Key', example='RelatedResourceRegionId'),
      matchType?: string(name='MatchType', example='Equals'),
      value?: [ string ](name='Value'),
    }
  ](name='RelatedResourceFilter'),
  resourceId?: string(name='ResourceId', description='This parameter is required.', example='m-eb3hji****'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='ACS::ACK::Cluster'),
  scope?: string(name='Scope', description='This parameter is required.', example='rd-r4****'),
}

model ListMultiAccountResourceRelationshipsResponseBody = {
  maxResults?: int32(name='MaxResults', example='10'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', example='BCAB07BA-82FA-5DC0-9322-FB7ED726481D'),
  resourceRelationships?: [ 
    {
      accountId?: string(name='AccountId', example='193396142051****'),
      regionId?: string(name='RegionId', example='cn-hangzhou'),
      relatedResourceId?: string(name='RelatedResourceId', example='vpc-uf6m5okksddm6c9lh7***'),
      relatedResourceRegionId?: string(name='RelatedResourceRegionId', example='cn-shanghai'),
      relatedResourceType?: string(name='RelatedResourceType', example='ACS::VPC::VPC'),
      resourceId?: string(name='ResourceId', example='m-eb3hji****'),
      resourceType?: string(name='ResourceType', example='ACS::ACK::Cluster'),
    }
  ](name='ResourceRelationships'),
  scope?: string(name='Scope', example='rd-r4****'),
}

model ListMultiAccountResourceRelationshipsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMultiAccountResourceRelationshipsResponseBody(name='body'),
}

/**
 * @summary 跨账号列出资源关系
 *
 * @param request ListMultiAccountResourceRelationshipsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMultiAccountResourceRelationshipsResponse
 */
async function listMultiAccountResourceRelationshipsWithOptions(request: ListMultiAccountResourceRelationshipsRequest, runtime: Util.RuntimeOptions): ListMultiAccountResourceRelationshipsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.relatedResourceFilter)) {
    query['RelatedResourceFilter'] = request.relatedResourceFilter;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMultiAccountResourceRelationships',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 跨账号列出资源关系
 *
 * @param request ListMultiAccountResourceRelationshipsRequest
 * @return ListMultiAccountResourceRelationshipsResponse
 */
async function listMultiAccountResourceRelationships(request: ListMultiAccountResourceRelationshipsRequest): ListMultiAccountResourceRelationshipsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMultiAccountResourceRelationshipsWithOptions(request, runtime);
}

model ListMultiAccountTagKeysRequest {
  matchType?: string(name='MatchType', description='The matching mode. Valid values:

*   Equals: equal match
*   Prefix: match by prefix', example='Equals'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the `token` to initiate another request and obtain the remaining entries.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  scope?: string(name='Scope', description='The search scope. You can set the value to one of the following items:

*   ID of a resource directory: Resources within the management account and all members of the resource directory are searched. You can call the [GetResourceDirectory](https://help.aliyun.com/document_detail/159995.html) operation to obtain the ID.
*   ID of the Root folder: Resources within all members in the Root folder and the subfolders of the Root folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a folder: Resources within all members in the folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a member: Resources within the member are searched. You can call the [ListAccounts](https://help.aliyun.com/document_detail/160016.html) operation to obtain the ID.

This parameter is required.', example='rd-r4****'),
  tagKey?: string(name='TagKey', description='The tag key.', example='test_key'),
}

model ListMultiAccountTagKeysResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAARfZmVDe9NvRXloR5+8CK9nNJufMdRA7W1miLC1P****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='FA6086F9-6363-51A5-A507-88E3201EBCCB'),
  tagKeys?: [ string ](name='TagKeys', description='The tag keys.'),
}

model ListMultiAccountTagKeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMultiAccountTagKeysResponseBody(name='body'),
}

/**
 * @summary Queries the tag keys of resources within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountTagKeysRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMultiAccountTagKeysResponse
 */
async function listMultiAccountTagKeysWithOptions(request: ListMultiAccountTagKeysRequest, runtime: Util.RuntimeOptions): ListMultiAccountTagKeysResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.matchType)) {
    query['MatchType'] = request.matchType;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMultiAccountTagKeys',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tag keys of resources within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountTagKeysRequest
 * @return ListMultiAccountTagKeysResponse
 */
async function listMultiAccountTagKeys(request: ListMultiAccountTagKeysRequest): ListMultiAccountTagKeysResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMultiAccountTagKeysWithOptions(request, runtime);
}

model ListMultiAccountTagValuesRequest {
  matchType?: string(name='MatchType', description='The matching mode. Valid values:

*   Equals: equal match
*   Prefix: match by prefix', example='Equals'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the `token` to initiate another request and obtain the remaining entries.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  scope?: string(name='Scope', description='The search scope. You can set the value to one of the following items:

*   ID of a resource directory: Resources within the management account and all members of the resource directory are searched. You can call the [GetResourceDirectory](https://help.aliyun.com/document_detail/159995.html) operation to obtain the ID.
*   ID of the Root folder: Resources within all members in the Root folder and the subfolders of the Root folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a folder: Resources within all members in the folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a member: Resources within the member are searched. You can call the [ListAccounts](https://help.aliyun.com/document_detail/160016.html) operation to obtain the ID.', example='rd-r4****'),
  tagKey?: string(name='TagKey', description='The tag key.

This parameter is required.', example='test_key'),
  tagValue?: string(name='TagValue', description='The tag value.', example='test_value'),
}

model ListMultiAccountTagValuesResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='36A3D9BE-B607-5993-B546-7E19EF65DC00'),
  tagValues?: [ string ](name='TagValues', description='The tag values.'),
}

model ListMultiAccountTagValuesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMultiAccountTagValuesResponseBody(name='body'),
}

/**
 * @summary Queries the tag values of resources within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountTagValuesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMultiAccountTagValuesResponse
 */
async function listMultiAccountTagValuesWithOptions(request: ListMultiAccountTagValuesRequest, runtime: Util.RuntimeOptions): ListMultiAccountTagValuesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.matchType)) {
    query['MatchType'] = request.matchType;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  if (!Util.isUnset(request.tagValue)) {
    query['TagValue'] = request.tagValue;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMultiAccountTagValues',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tag values of resources within the management account or a member of a resource directory by using the management account of the resource directory or a delegated administrator account of Resource Center.
 *
 * @param request ListMultiAccountTagValuesRequest
 * @return ListMultiAccountTagValuesResponse
 */
async function listMultiAccountTagValues(request: ListMultiAccountTagValuesRequest): ListMultiAccountTagValuesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMultiAccountTagValuesWithOptions(request, runtime);
}

model ListResourceRelationshipsRequest {
  maxResults?: int32(name='MaxResults', example='10'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  relatedResourceFilter?: [ 
    {
      key?: string(name='Key', example='RelatedResourceRegionId'),
      matchType?: string(name='MatchType', example='Equals'),
      value?: [ string ](name='Value'),
    }
  ](name='RelatedResourceFilter'),
  resourceId?: string(name='ResourceId', description='This parameter is required.', example='m-eb3hji****'),
  resourceType?: string(name='ResourceType', description='This parameter is required.', example='ACS::ACK::Cluster'),
}

model ListResourceRelationshipsResponseBody = {
  maxResults?: int32(name='MaxResults', example='10'),
  nextToken?: string(name='NextToken', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', example='682A3004-38E3-5122-9A11-CCDFAB9C3C4F'),
  resourceRelationships?: [ 
    {
      regionId?: string(name='RegionId', example='cn-hangzhou'),
      relatedResourceId?: string(name='RelatedResourceId', example='vpc-uf6m5okksddm6c9lh7***'),
      relatedResourceRegionId?: string(name='RelatedResourceRegionId', example='cn-shanghai'),
      relatedResourceType?: string(name='RelatedResourceType', example='ACS::VPC::VPC'),
      resourceId?: string(name='ResourceId', example='m-eb3hji****'),
      resourceType?: string(name='ResourceType', example='ACS::ACK::Cluster'),
    }
  ](name='ResourceRelationships'),
}

model ListResourceRelationshipsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListResourceRelationshipsResponseBody(name='body'),
}

/**
 * @summary 列出资源关系
 *
 * @param request ListResourceRelationshipsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListResourceRelationshipsResponse
 */
async function listResourceRelationshipsWithOptions(request: ListResourceRelationshipsRequest, runtime: Util.RuntimeOptions): ListResourceRelationshipsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.relatedResourceFilter)) {
    query['RelatedResourceFilter'] = request.relatedResourceFilter;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceRelationships',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 列出资源关系
 *
 * @param request ListResourceRelationshipsRequest
 * @return ListResourceRelationshipsResponse
 */
async function listResourceRelationships(request: ListResourceRelationshipsRequest): ListResourceRelationshipsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourceRelationshipsWithOptions(request, runtime);
}

model ListResourceTypesRequest {
  acceptLanguage?: string(name='AcceptLanguage', description='The language of the response. Valid values:

*   zh-CN: Chinese
*   en-US: English', example='zh-CN'),
  query?: [ string ](name='Query', description='The query conditions.'),
  resourceType?: string(name='ResourceType', description='The resource type.

For more information about the resource types that are supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).', example='ACS::ACK::Cluster'),
}

model ListResourceTypesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='E5556E4C-479A-5BBB-B325-F07563E7E917'),
  resourceTypes?: [ 
    {
      codeMapping?: {
        resourceGroup?: string(name='ResourceGroup', description='The resource group.', example='cs.cluster'),
        tag?: string(name='Tag', description='The tag.', example='cs.cluster'),
      }(name='CodeMapping', description='The code mapping of the resource type.'),
      filterKeys?: [ string ](name='FilterKeys', description='The supported filter conditions.'),
      productName?: string(name='ProductName', description='The name of the Alibaba Cloud service.', example='Container Service for Kubernetes'),
      relatedResourceTypes?: [ string ](name='RelatedResourceTypes'),
      resourceType?: string(name='ResourceType', description='The resource type.', example='ACS::ACK::Cluster'),
      resourceTypeName?: string(name='ResourceTypeName', description='The name of the resource type.', example='Cluster'),
    }
  ](name='ResourceTypes', description='The resource types.'),
}

model ListResourceTypesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListResourceTypesResponseBody(name='body'),
}

/**
 * @summary Queries the metadata of resource types.
 *
 * @param request ListResourceTypesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListResourceTypesResponse
 */
async function listResourceTypesWithOptions(request: ListResourceTypesRequest, runtime: Util.RuntimeOptions): ListResourceTypesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['AcceptLanguage'] = request.acceptLanguage;
  }
  if (!Util.isUnset(request.query)) {
    query['Query'] = request.query;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceTypes',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the metadata of resource types.
 *
 * @param request ListResourceTypesRequest
 * @return ListResourceTypesResponse
 */
async function listResourceTypes(request: ListResourceTypesRequest): ListResourceTypesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listResourceTypesWithOptions(request, runtime);
}

model ListSavedQueriesRequest {
  maxResults?: string(name='MaxResults', description='The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 50.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
}

model ListSavedQueriesResponseBody = {
  maxResults?: string(name='MaxResults', description='The maximum number of entries per page.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAARfZmVDe9NvRXloR5+8CK9nNJufMdRA7W1miLC1P****'),
  requestId?: string(name='RequestId', description='The request ID.', example='D696E6EF-3A6D-5770-801E-4982081FE4D0'),
  savedQueries?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the template was created. The time is displayed in UTC.', example='2022-01-13T05:50:35Z'),
      description?: string(name='Description', description='The description of the template.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
      name?: string(name='Name', description='The template name.', example='Query of All Alibaba Cloud Resources'),
      queryId?: string(name='QueryId', description='The template ID.', example='sq-GeAck****'),
      updateTime?: string(name='UpdateTime', description='The time when the template was updated. The time is displayed in UTC.', example='2023-03-14 10:27:07'),
    }
  ](name='SavedQueries', description='The information about the custom query templates.'),
}

model ListSavedQueriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSavedQueriesResponseBody(name='body'),
}

/**
 * @summary Queries all custom query templates.
 *
 * @param request ListSavedQueriesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSavedQueriesResponse
 */
async function listSavedQueriesWithOptions(request: ListSavedQueriesRequest, runtime: Util.RuntimeOptions): ListSavedQueriesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSavedQueries',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all custom query templates.
 *
 * @param request ListSavedQueriesRequest
 * @return ListSavedQueriesResponse
 */
async function listSavedQueries(request: ListSavedQueriesRequest): ListSavedQueriesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSavedQueriesWithOptions(request, runtime);
}

model ListTagKeysRequest {
  matchType?: string(name='MatchType', description='The matching mode. Valid values:

*   Equals: equal match
*   Prefix: match by prefix', example='Equals'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the `token` to initiate another request and obtain the remaining entries.', example='AAAAAUYb00R0gHZBE8FVDeoh2ME93VeeEPUHs****'),
  tagKey?: string(name='TagKey', description='The tag key.', example='test_key'),
}

model ListTagKeysResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAAUDnubHKJbVTCdlIGYUPtsu3EoN3bfdgjDA****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='44C8A952-D6B0-5BC8-82D5-93BA02E26F2E'),
  tagKeys?: [ string ](name='TagKeys', description='The tag keys.'),
}

model ListTagKeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagKeysResponseBody(name='body'),
}

/**
 * @summary Queries the tag keys of resources within the current account.
 *
 * @param request ListTagKeysRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagKeysResponse
 */
async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: Util.RuntimeOptions): ListTagKeysResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.matchType)) {
    query['MatchType'] = request.matchType;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagKeys',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tag keys of resources within the current account.
 *
 * @param request ListTagKeysRequest
 * @return ListTagKeysResponse
 */
async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagKeysWithOptions(request, runtime);
}

model ListTagValuesRequest {
  matchType?: string(name='MatchType', description='The matching mode. Valid values:

*   Equals: equal match
*   Prefix: match by prefix', example='Equals'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the `token` to initiate another request and obtain the remaining entries.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  tagKey?: string(name='TagKey', description='The tag key.

This parameter is required.', example='test_key'),
  tagValue?: string(name='TagValue', description='The tag value.', example='test_value'),
}

model ListTagValuesResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C1840B83-1193-5E83-AFA6-4B8D303E29F5'),
  tagValues?: [ string ](name='TagValues', description='The tag values.'),
}

model ListTagValuesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagValuesResponseBody(name='body'),
}

/**
 * @summary Queries the tag values of resources within the current account.
 *
 * @param request ListTagValuesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagValuesResponse
 */
async function listTagValuesWithOptions(request: ListTagValuesRequest, runtime: Util.RuntimeOptions): ListTagValuesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.matchType)) {
    query['MatchType'] = request.matchType;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  if (!Util.isUnset(request.tagValue)) {
    query['TagValue'] = request.tagValue;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagValues',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tag values of resources within the current account.
 *
 * @param request ListTagValuesRequest
 * @return ListTagValuesResponse
 */
async function listTagValues(request: ListTagValuesRequest): ListTagValuesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagValuesWithOptions(request, runtime);
}

model SearchMultiAccountResourcesRequest {
  filter?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition. For more information, see `Supported filter parameters`.', example='ResourceGroupId'),
      matchType?: string(name='MatchType', description='The matching mode.

The value Equals indicates an equal match.', example='Equals'),
      value?: [ string ](name='Value', description='The values of the filter condition.'),
    }
  ](name='Filter', description='The filter conditions.'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the token to initiate another request and obtain the remaining entries.``', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  scope?: string(name='Scope', description='The search scope. You can set the value to one of the following items:

*   ID of a resource directory: Resources within the management account and all members of the resource directory are searched. You can call the [GetResourceDirectory](https://help.aliyun.com/document_detail/159995.html) operation to obtain the ID.
*   ID of the Root folder: Resources within all members in the Root folder and the subfolders of the Root folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a folder: Resources within all members in the folder are searched. You can call the [ListFoldersForParent](https://help.aliyun.com/document_detail/159997.html) operation to obtain the ID.
*   ID of a member: Resources within the member are searched. You can call the [ListAccounts](https://help.aliyun.com/document_detail/160016.html) operation to obtain the ID.

This parameter is required.', example='rd-r4****'),
  sortCriterion?: {
    key?: string(name='Key', description='The attribute based on which the entries are sorted.

The value CreateTime indicates the creation time of resources.', example='CreateTime'),
    order?: string(name='Order', description='The order in which the entries are sorted. Valid values:

*   ASC: The entries are sorted in ascending order. This value is the default value.
*   DESC: The entries are sorted in descending order.', example='ASC'),
  }(name='SortCriterion', description='The method that is used to sort the entries returned.'),
}

model SearchMultiAccountResourcesResponseBody = {
  filters?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition.', example='RegionId'),
      matchType?: string(name='MatchType', description='The matching mode.', example='Equals'),
      values?: [ string ](name='Values', description='The values of the filter condition.'),
    }
  ](name='Filters', description='The filter conditions.'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries returned per page.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='The pagination token that is used in the next request to retrieve a new page of results.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='EFA806B9-7F36-55AB-8B7A-D680C2C5EE57'),
  resources?: [ 
    {
      accountId?: string(name='AccountId', description='The ID of the management account or member of the resource directory.', example='151266687691****'),
      createTime?: string(name='CreateTime', description='The time when the resource was created.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.', example='2021-06-30T09:20:08Z'),
      expireTime?: string(name='ExpireTime', description='The time when the resource expires.', example='2023-06-14T14:35:45Z'),
      ipAddressAttributes?: [ 
        {
          ipAddress?: string(name='IpAddress', description='The IP address.'),
          networkType?: string(name='NetworkType', description='The network type. Valid values:

*   **Public**: the Internet
*   **Private**: internal network', example='Public'),
          version?: string(name='Version', description='The version.', example='Ipv4'),
        }
      ](name='IpAddressAttributes', description='The attributes of the IP address.'),
      ipAddresses?: [ string ](name='IpAddresses', description='The IP addresses.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-acfmzawhxxc****'),
      resourceId?: string(name='ResourceId', description='The resource ID.', example='vtb-bp11lbh452fr8940s****'),
      resourceName?: string(name='ResourceName', description='The resource name.', example='group1'),
      resourceType?: string(name='ResourceType', description='The resource type.', example='ACS::VPC::RouteTable'),
      tags?: [ 
        {
          key?: string(name='Key', description='The key of tag N.', example='test_key'),
          value?: string(name='Value', description='The value of tag N.', example='test_value'),
        }
      ](name='Tags', description='The tags.'),
      zoneId?: string(name='ZoneId', description='The zone ID.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.', example='cn-hangzhou-k'),
    }
  ](name='Resources', description='The information about the resources.'),
  scope?: string(name='Scope', description='The search scope.

*   ID of a resource directory: Resources within the management account and all members of the resource directory are searched.
*   ID of the Root folder: Resources within all members in the Root folder and the subfolders of the Root folder are searched.
*   ID of a folder: Resources within all members in the folder are searched.
*   ID of a member: Resources within the member are searched.', example='rd-r4****'),
}

model SearchMultiAccountResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchMultiAccountResourcesResponseBody(name='body'),
}

/**
 * @summary Searches for resources within the management account or members of a resource directory.
 *
 * @description *   You can use this operation to search for only resources whose types are supported by Resource Center in services that work with Resource Center. For more information about the services and the resource types that are supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).
 * *   Before you use a RAM user or a RAM role to call the operation, you must make sure that the RAM user or RAM role is granted the required permissions. For more information, see [Grant a RAM user the permissions to use Resource Center](https://help.aliyun.com/document_detail/600556.html).
 * *   By default, the operation returns a maximum of 20 entries. You can configure the `MaxResults` parameter to specify the maximum number of entries to return.
 * *   If the response does not contain the `NextToken` parameter, all entries are returned. Otherwise, more entries exist. If you want to obtain the entries, you can call the operation again to initiate another query request. In the request, set the `NextToken` parameter to the value of `NextToken` in the last response of the operation. If you do not configure the `NextToken` parameter, entries on the first page are returned by default.
 * *   You can specify one or more filter conditions to narrow the search scope. For more information about supported filter parameters and matching methods, see the Supported filter parameters section. Multiple filter conditions have logical `AND` relations. Only resources that meet all filter conditions are returned. The values of a filter condition have logical `OR` relations. Resources that meet any value of the filter condition are returned.
 * *   You can visit [Sample Code Center](https://api.alibabacloud.com/api-tools/demo/ResourceCenter) to view more sample queries.
 *
 * @param request SearchMultiAccountResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchMultiAccountResourcesResponse
 */
async function searchMultiAccountResourcesWithOptions(request: SearchMultiAccountResourcesRequest, runtime: Util.RuntimeOptions): SearchMultiAccountResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!Util.isUnset(request.sortCriterion)) {
    query['SortCriterion'] = request.sortCriterion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchMultiAccountResources',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Searches for resources within the management account or members of a resource directory.
 *
 * @description *   You can use this operation to search for only resources whose types are supported by Resource Center in services that work with Resource Center. For more information about the services and the resource types that are supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).
 * *   Before you use a RAM user or a RAM role to call the operation, you must make sure that the RAM user or RAM role is granted the required permissions. For more information, see [Grant a RAM user the permissions to use Resource Center](https://help.aliyun.com/document_detail/600556.html).
 * *   By default, the operation returns a maximum of 20 entries. You can configure the `MaxResults` parameter to specify the maximum number of entries to return.
 * *   If the response does not contain the `NextToken` parameter, all entries are returned. Otherwise, more entries exist. If you want to obtain the entries, you can call the operation again to initiate another query request. In the request, set the `NextToken` parameter to the value of `NextToken` in the last response of the operation. If you do not configure the `NextToken` parameter, entries on the first page are returned by default.
 * *   You can specify one or more filter conditions to narrow the search scope. For more information about supported filter parameters and matching methods, see the Supported filter parameters section. Multiple filter conditions have logical `AND` relations. Only resources that meet all filter conditions are returned. The values of a filter condition have logical `OR` relations. Resources that meet any value of the filter condition are returned.
 * *   You can visit [Sample Code Center](https://api.alibabacloud.com/api-tools/demo/ResourceCenter) to view more sample queries.
 *
 * @param request SearchMultiAccountResourcesRequest
 * @return SearchMultiAccountResourcesResponse
 */
async function searchMultiAccountResources(request: SearchMultiAccountResourcesRequest): SearchMultiAccountResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchMultiAccountResourcesWithOptions(request, runtime);
}

model SearchResourcesRequest {
  filter?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition. For more information, see `Supported filter parameters`.', example='RegionId'),
      matchType?: string(name='MatchType', description='The matching mode.

The value Equals indicates an equal match.', example='Equals'),
      value?: [ string ](name='Value', description='The values of the filter condition.'),
    }
  ](name='Filter', description='The filter conditions.'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page.

Valid values: 1 to 100.

Default value: 20.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If the total number of entries returned for the current request exceeds the value of the `MaxResults` parameter, the entries are truncated. In this case, you can use the `token` to initiate another request and obtain the remaining entries.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmzawhxxc****'),
  sortCriterion?: {
    key?: string(name='Key', description='The attribute based on which the entries are sorted.

The value CreateTime indicates the creation time of resources.', example='CreateTime'),
    order?: string(name='Order', description='The order in which the entries are sorted. Valid values:

*   ASC: The entries are sorted in ascending order. This value is the default value.
*   DESC: The entries are sorted in descending order.', example='ASC'),
  }(name='SortCriterion', description='The method that is used to sort the entries returned.'),
}

model SearchResourcesResponseBody = {
  filters?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition.', example='RegionId'),
      matchType?: string(name='MatchType', description='The matching mode.', example='Equals'),
      values?: [ string ](name='Values', description='The values of the filter condition.'),
    }
  ](name='Filters', description='The filter conditions.'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries returned per page.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D696E6EF-3A6D-5770-801E-4982081FE4D0'),
  resources?: [ 
    {
      accountId?: string(name='AccountId', description='The ID of the Alibaba Cloud account.', example='151266687691****'),
      createTime?: string(name='CreateTime', description='The time when the resource was created.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.', example='2021-06-30T09:20:08Z'),
      expireTime?: string(name='ExpireTime', description='The time when the resource expires.', example='2021-07-30T09:20:08Z'),
      ipAddressAttributes?: [ 
        {
          ipAddress?: string(name='IpAddress', description='The IP address.'),
          networkType?: string(name='NetworkType', description='The network type. Valid values:

*   **Public**: the Internet
*   **Private**: internal network', example='Public'),
          version?: string(name='Version', description='The version.', example='Ipv4'),
        }
      ](name='IpAddressAttributes', description='The attributes of the IP address.'),
      ipAddresses?: [ string ](name='IpAddresses', description='The IP addresses.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-acfmzawhxxc****'),
      resourceId?: string(name='ResourceId', description='The resource ID.', example='vtb-bp11lbh452fr8940s****'),
      resourceName?: string(name='ResourceName', description='The resource name.', example='group1'),
      resourceType?: string(name='ResourceType', description='The resource type.', example='ACS::VPC::RouteTable'),
      tags?: [ 
        {
          key?: string(name='Key', description='The key of tag N.', example='test_key'),
          value?: string(name='Value', description='The value of tag N.', example='test_value'),
        }
      ](name='Tags', description='The tags.'),
      zoneId?: string(name='ZoneId', description='The zone ID.

>  Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.', example='cn-hangzhou-k'),
    }
  ](name='Resources', description='The information about the resources.'),
}

model SearchResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchResourcesResponseBody(name='body'),
}

/**
 * @summary Search for resources that you can access within the current account.
 *
 * @description *   You can use this operation to search for only resources whose types are supported by Resource Center in services that work with Resource Center. For more information about the services and the resource types that are supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).
 * *   By default, the operation returns a maximum of 20 entries. You can configure the `MaxResults` parameter to specify the maximum number of entries to return.
 * *   If the response does not contain the `NextToken` parameter, all entries are returned. Otherwise, more entries exist. If you want to obtain the entries, you can call the operation again to initiate another query request. In the request, set the `NextToken` parameter to the value of `NextToken` in the last response of the operation. If you do not configure the `NextToken` parameter, entries on the first page are returned by default.
 * *   You can specify one or more filter conditions to narrow the search scope. For more information about supported filter parameters and matching methods, see the Supported filter parameters section. Multiple filter conditions have logical `AND` relations. Only resources that meet all filter conditions are returned. The values of a filter condition have logical `OR` relations. Resources that meet any value of the filter condition are returned.
 * *   You can visit [Sample Code Center](https://api.aliyun.com/api-tools/demo/ResourceCenter) to view more sample queries.
 *
 * @param request SearchResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchResourcesResponse
 */
async function searchResourcesWithOptions(request: SearchResourcesRequest, runtime: Util.RuntimeOptions): SearchResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filter)) {
    query['Filter'] = request.filter;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sortCriterion)) {
    query['SortCriterion'] = request.sortCriterion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchResources',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Search for resources that you can access within the current account.
 *
 * @description *   You can use this operation to search for only resources whose types are supported by Resource Center in services that work with Resource Center. For more information about the services and the resource types that are supported by Resource Center, see [Services that work with Resource Center](https://help.aliyun.com/document_detail/477798.html).
 * *   By default, the operation returns a maximum of 20 entries. You can configure the `MaxResults` parameter to specify the maximum number of entries to return.
 * *   If the response does not contain the `NextToken` parameter, all entries are returned. Otherwise, more entries exist. If you want to obtain the entries, you can call the operation again to initiate another query request. In the request, set the `NextToken` parameter to the value of `NextToken` in the last response of the operation. If you do not configure the `NextToken` parameter, entries on the first page are returned by default.
 * *   You can specify one or more filter conditions to narrow the search scope. For more information about supported filter parameters and matching methods, see the Supported filter parameters section. Multiple filter conditions have logical `AND` relations. Only resources that meet all filter conditions are returned. The values of a filter condition have logical `OR` relations. Resources that meet any value of the filter condition are returned.
 * *   You can visit [Sample Code Center](https://api.aliyun.com/api-tools/demo/ResourceCenter) to view more sample queries.
 *
 * @param request SearchResourcesRequest
 * @return SearchResourcesResponse
 */
async function searchResources(request: SearchResourcesRequest): SearchResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchResourcesWithOptions(request, runtime);
}

model UpdateFilterRequest {
  filterConfiguration?: string(name='FilterConfiguration', description='The configurations of the filter.

This parameter is required.', example='{
  "regions": [],
  "tagFilters": [
    [{ "type": "notContainTagKey", "tagKey": "xxx", "tagValue": "" }],
    [{ "tagKey": "xxx", "tagValue": "xxx" }]
  ],
  "resourceTypes": [
    "ACS::ECS::AutoSnapshotPolicy"
  ]
}'),
  filterName?: string(name='FilterName', description='The name of the filter.

This parameter is required.', example='ECS'),
}

model UpdateFilterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3C5CDBF6-4DB7-53E9-ADDC-5919E3FACF6F'),
}

model UpdateFilterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateFilterResponseBody(name='body'),
}

/**
 * @summary Updates a filter.
 *
 * @param request UpdateFilterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateFilterResponse
 */
async function updateFilterWithOptions(request: UpdateFilterRequest, runtime: Util.RuntimeOptions): UpdateFilterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.filterConfiguration)) {
    query['FilterConfiguration'] = request.filterConfiguration;
  }
  if (!Util.isUnset(request.filterName)) {
    query['FilterName'] = request.filterName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateFilter',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a filter.
 *
 * @param request UpdateFilterRequest
 * @return UpdateFilterResponse
 */
async function updateFilter(request: UpdateFilterRequest): UpdateFilterResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateFilterWithOptions(request, runtime);
}

model UpdateSavedQueryRequest {
  description?: string(name='Description', description='The description of the template.

The description must be 1 to 256 characters in length.', example='Queries all resources on which you have permissions and sorts the resources by resource type and resource ID.'),
  expression?: string(name='Expression', description='The query statement in the template.', example='SELECT * FROM resources;'),
  name?: string(name='Name', description='The name of the template.

*   The name must be 1 to 64 characters in length.
*   The name can contain letters, digits, underscores (_), and hyphens (-).
*   The name must be unique.', example='Query of All Alibaba Cloud Resources'),
  queryId?: string(name='QueryId', description='The template ID.

This parameter is required.', example='sq-GeAck****'),
}

model UpdateSavedQueryResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D696E6EF-3A6D-5770-801E-4982081FE4D0'),
}

model UpdateSavedQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateSavedQueryResponseBody(name='body'),
}

/**
 * @summary Updates a custom query template.
 *
 * @param request UpdateSavedQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateSavedQueryResponse
 */
async function updateSavedQueryWithOptions(request: UpdateSavedQueryRequest, runtime: Util.RuntimeOptions): UpdateSavedQueryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.expression)) {
    query['Expression'] = request.expression;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.queryId)) {
    query['QueryId'] = request.queryId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSavedQuery',
    version = '2022-12-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a custom query template.
 *
 * @param request UpdateSavedQueryRequest
 * @return UpdateSavedQueryResponse
 */
async function updateSavedQuery(request: UpdateSavedQueryRequest): UpdateSavedQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateSavedQueryWithOptions(request, runtime);
}

